package com.nova.bluetooth.base;

import android.app.Application;
import android.content.Context;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.ViewModelStoreOwner;

import com.nova.bluetooth.helpUtils.CustomViewToastUtil;
import com.nova.bluetooth.helpUtils.ToastUtils;
import com.tencent.mmkv.MMKV;


public class BaseApp extends Application implements ViewModelStoreOwner {
    private ViewModelStore mAppViewModelStore;
    public static BaseApp app;

    @Override
    public void onCreate() {
        super.onCreate();
        app = this;
    }

    protected void init() {
        AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);  //配置禁用夜间模式
        mAppViewModelStore = new ViewModelStore();
        ToastUtils.init(app);
        MMKV.initialize(app);
        CustomViewToastUtil.init(app);
    }

    @NonNull
    @Override
    public ViewModelStore getViewModelStore() {
        return mAppViewModelStore;
    }

    @Override
    protected void attachBaseContext(Context context) {
        super.attachBaseContext(context);
    }


}
